package com.ctg.itrdc.imageconsole.servcie.user;

import com.ctg.itrdc.imageconsole.common.util.PropertiesUtils;

public class ConfigReader {
	
	private static String configProperties = "config.properties";
	
	public static String readSysManagerEndpoint() {
		return PropertiesUtils.getConfigValueCache(configProperties, "sysManager.endpoint");
	}
	
	public static Long readSysManagerStaffId() {
		String staffId = PropertiesUtils.getConfigValueCache(configProperties, "sysManager.staffId");
		
		return new Long(staffId);
	}
	
	public static String readSysManagerStaffCode() {
		return PropertiesUtils.getConfigValueCache(configProperties, "sysManager.staffCode");
	}
	
	public static String readSysManagerSysCode() {
		return PropertiesUtils.getConfigValueCache(configProperties, "sysManager.sysCode");
	}
	
	public static String readHarborVip() {
		return PropertiesUtils.getConfigValueCache(configProperties, "harbor.vip");
	}
	
	public static String readHarborUsername() {
		return PropertiesUtils.getConfigValueCache(configProperties, "harbor.username");
	}
	
	public static String readHarborPassword() {
		return PropertiesUtils.getConfigValueCache(configProperties, "harbor.password");
	}
	
	public static String[] readHarborHarbors() {
		String key = "harbor.harbors";
		String harbors = PropertiesUtils.getConfigValueCache(configProperties, key);
		if(null == harbors)
			throw new RuntimeException(String.format("Error : %s is not found in %s", key, configProperties));
		return harbors.split(",");
	}
}
